<?
class QDServiceLocatorQD implements QDLocator{
	protected $base = '.';
	public function __construct($directory='.')    {
		$this->base = (string) $directory;
	}
	public function canLocate($class)    {
		$path = $this->getPath($class);
		return file_exists($path);
	}
	public function getPath($class)    {
		 if ($class=='Smarty'){
		 	return $this->base.'/libs/3rd_php/smarty/Smarty.class.php';
		 }
		$arrModules=glob($this->base.'/modules/*',GLOB_ONLYDIR);
		array_unshift($arrModules,$this->base.'/libs/3rd_php');
		array_unshift($arrModules,$this->base.'/libs/3rd_php/smarty/sysplugins');
		$rtn='';
		foreach ($arrModules as $k){
			if (file_exists($k.'/'.$class.'.php')){
				$rtn = $k.'/'.$class.'.php';
				break;
			}
		}
		return $rtn;
	}
}
QDServiceLocator::attachLocator(new QDServiceLocatorQD(), 'QD');
?>